"use client";

import { Button, Space } from "antd";
import { PlusOutlined } from "@ant-design/icons";
import { useState } from "react";
import { StepForm } from "./StepForm";

interface StepActionsProps {
  taskId: string;
  onSuccess: () => void;
}

export function StepActions({ taskId, onSuccess }: StepActionsProps) {
  const [isModalOpen, setIsModalOpen] = useState(false);

  return (
    <>
      <Button
        type="primary"
        icon={<PlusOutlined />}
        onClick={() => setIsModalOpen(true)}
      >
        添加步骤
      </Button>

      <StepForm
        taskId={taskId}
        open={isModalOpen}
        onCancel={() => setIsModalOpen(false)}
        onSuccess={() => {
          setIsModalOpen(false);
          onSuccess();
        }}
      />
    </>
  );
} 